package com.jy.shenghuilogistics.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jy.shenghuilogistics.bean.Employee;
import com.jy.shenghuilogistics.service.EmployService;

import javax.annotation.Resource;
import java.util.List;

@RestController()
@CrossOrigin
public class EmpController {
    @Resource
    EmployService employService;
    //修改员工
    @PostMapping("updEmp")
    public String updEmp(Employee e) {
        return employService.updEmp(e).toString();
    }
    //添加员工
    @PostMapping("addEmp")
    public String addEmp(Employee e) {
        return employService.addEmp(e).toString();
    }
    //模糊查询员工
    @GetMapping("selEmp")
    public List<Employee> selEmp(Employee e) {
        return employService.selEmp(e);
    }
    //根据账号密码查询员工
    @PostMapping("getEmpByAccPwd")
    public Employee getEmpByAccPwd(Employee e) {
        return employService.getEmpByAccPwd(e.getEmpAccount(),e.getEmpPwd());
    }
    //根据id查询员工
    @GetMapping("getEmpById")
    public Employee getEmpById(Integer id) {
        return employService.getEmpById(id);
    }
}
